﻿Imports MbUnit.Framework
Imports FM.NetBouncer.Rules
Imports FM.NetBouncer

<TestFixture()> _
Public Class ModifiersFixture
    <Test()> _
    Public Sub HTML()
        Dim HTMLRule As New RuleSet(Of String)
        HTMLRule.Modifiers.Add(New Modifiers.HTML)
        Dim Param As New BaseParameter(Of String, String)("<html>", HTMLRule)

        Assert.IsTrue(Param.IsValid)

        Assert.AreEqual(Param.Value, "&#60;html&#62;")


    End Sub

    <Test()> _
    Public Sub HtmlNothing()
        Dim HTMLRule As New RuleSet(Of String)
        HTMLRule.Modifiers.Add(New Modifiers.HTML)

        Dim Param As New BaseParameter(Of String, String)(Nothing, HTMLRule)
        Assert.AreEqual(Param.Value, Nothing)


        Dim HtmlModifier As New Modifiers.HTML
        Assert.AreEqual(HtmlModifier.Convert(Nothing), Nothing)

    End Sub


    <Test()> _
    Public Sub HTMLTestWithEscapeTo()

        Dim HTMLRule As New RuleSet(Of String)
        Dim Param As New Parameter("<html>", HTMLRule)
        Assert.IsTrue(Param.IsValid)
        Assert.AreEqual(Param.Value, "<html>")
        Assert.AreEqual(Param.EscapeTo(New Modifiers.HTML, False), "&#60;html&#62;")
        Assert.AreEqual(Param.EscapeTo(New Modifiers.HTML), "&#60;html&#62;")
        Assert.AreEqual(Param.EscapeToHtml(), "&#60;html&#62;")

    End Sub



End Class
